import pymysql

con = pymysql.connect(user="root",
                      passwd="root",
                      db="bangjiang",
                      host="127.0.0.1",
                      local_infile=1)

device_table_count = 806
for i in range(41, device_table_count):
    sql = 'CREATE TABLE `gate_pass_info_device_{}`  (`device` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,`gate_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,`car_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,`card_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,`pass_timestamp` bigint(255) NULL DEFAULT NULL,`location` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,`card_tail` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,`secret_card` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC'.format(i)
    cursor = con.cursor()
    result = cursor.execute(sql)
    print('create gate_pass_info_device_{}'.format(i))

con.commit()